package com.wft.singleton;

import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;

public class Test01Hungry {
    private static Test01Hungry instance = new Test01Hungry();

    private Test01Hungry() {
    }

    public static Test01Hungry getInstance() {
        return instance;
    }

    public static void main(String[] args) throws IllegalAccessException, InstantiationException {
        System.out.println(Test01Hungry.getInstance());
        System.out.println(Test01Hungry.getInstance());


        Test01Hungry test01Hungry = Test01Hungry.class.newInstance();
        System.out.println(test01Hungry);
    }

    private void readObject(ObjectInputStream in) throws IOException,
            ClassNotFoundException {
        throw new InvalidObjectException("can't deserialize enum");
    }
}
